<template>
  <div class="select-source">
    <div class="mut-select f-l">
      <el-select
        v-model="selectVal"
        multiple
        collapse-tags
        placeholder="请选择">
        <el-option
          v-for="item in options"
          :key="item.dicKey"
          :label="item.dicValue"
          :value="item.dicKey">
        </el-option>
      </el-select>
    </div>
  </div>
</template>

<script>
export default {
  name: 'selectSource',
  props: ['selectObj'],
  data () {
    return {
      options: [],
      selectVal: []
    }
  },
  mounted () {
    this.getDate()
  },
  computed: {

  },
  methods: {
    getDate () {
      this.$axios({
        url: this.Monitor +
          '/dic/type/' +
          this.selectObj.type,
        method: 'get'
      })
        .then(res => {
          this.options = res.data.data
          console.log(res.data.data)
        })
        .catch(err => {
          console.log(this.selectObj.title, err)
        })
    }
  }, // methods end
  watch: {
    selectVal (val) {
      let data = {
        type: this.selectObj.type,
        val: val
      }
      this.$emit('selectFn', data)
      console.log(val)
    }
  }
}
</script>

<style scoped>

</style>
